﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace WeiSiCopy
{
    public class Log
    {
        public Log()
        {
            //
            // TODO: 在此加入建構函式的程式碼
            //
        }
        public static void WriteLog(string strText, bool bAppend)
        {
            string LogFileName = BaseSetting.DesPath + "Log\\" + DateTime.Now.ToString("yyyy_MM_dd")+".txt";
           
            StreamWriter swFile = null;

            try
            {
                swFile = new StreamWriter(LogFileName, bAppend, Encoding.Default);

                swFile.WriteLine(DateTime.Now.ToString("HH:mm") + "   " + strText);

                swFile.Close();
                swFile = null;
            }
            catch( Exception ex)
            {
                string aa = ex.ToString();
            }
            finally
            {
                if (swFile != null)
                {
                    swFile.Close();
                    swFile = null;
                }
            }
        }
    }
}
